#ifndef __MODULE_H__
#define __MODULE_H__

#define NAME_SIZE 20
#define PASSWD_SIZE 20
#define FUNC_NAME_SIZE 20
#define FUNC_DESC_SIZE 255
#define INFO_NAME_SIZE 20
#define INFO_TEL_SIZE 11
#define INFO_ADDR_SIZE 50

#define OPT_TYPE_REGISTER 'R'
#define OPT_TYPE_LOGIN 'L'
#define OPT_UPDATE_PASSWORD 'U'
#define OPT_DELETE_ACCOUNT 'D'

#define USER_ROLE_ADMIN 1
#define USER_ROLE_USER 2

#define OPT_RESULT_OK 0
#define OPT_RESULT_FAIL -1
#define OPT_RESULT_SYS_ERR -2

#define ROLE_ADMIN_ID 1
#define ROLE_USER_ID 2

#define FUNC_REGISTER 1
#define FUNC_LOGIN 2
#define FUNC_CREATE_ACCOUNT 3
#define FUNC_EDITE_ACCOUNT 4
#define FUNC_DELETE_ACCOUNT 5
#define FUNC_USER_INFO 6
#define FUNC_EDITE_INFO 7
#define FUNC_UPLOAD 8
#define FUNC_DOWNLOAD 9
#define FUNC_DELETE_FILE 10
#define FUNC_UPLOAD_FILE_LIST 11
#define FUNC_CREATE_ADMIN_ACCOUNT 12
#define FUNC_CREATE_USER_ACCOUNT 13


typedef struct user_tab{
	int id;
	char username[NAME_SIZE];
	char passwd[PASSWD_SIZE];
}user_obj_t;

typedef struct role_tab{
	int id;
	char rolename;
}role_obj_t;

typedef struct user_role_tab{
	int id;
	int user_id;
	int role_id;
}user_role_obj_t;

typedef struct func_tab{
	int id;
	char func_name[FUNC_NAME_SIZE];
	char func_desc[FUNC_DESC_SIZE];
	int func_parent;
}func_obj_t;

typedef struct role_permission_tab{
	int id;
	int role_id;
	int func_id;
}role_permission_obj_t;

typedef struct user_info_tab{
	int id;
	int user_id;
	char name[INFO_NAME_SIZE];
	char tel[INFO_TEL_SIZE];
	char addr[INFO_ADDR_SIZE];
}user_info_obj_t;

typedef struct privary_tab{
	int id;
	int user_id;
	int salary;
}privary_obj_t;

typedef struct msg_node{
	char opt_type;
	int opt_result;
}msg_t;

#endif
